class EncounterTracker:
    def __init__(self):
        self.num_array = []

    def add_enemy_encounter(self, pathfinding_flag: int):

        if len(self.num_array) >= 1 and self.num_array[-1] == pathfinding_flag:
            return
        self.num_array.append(pathfinding_flag)

    def last_two_same(self) -> bool:
        if len(self.num_array) < 2:
            return False
        return self.num_array[-1] == self.num_array[-2]

    def last_one(self) -> bool:
        if len(self.num_array) < 1:
            return False
        return self.num_array[-1]

    def count_01_pairs(self) -> int:
        count = 0
        for i in range(len(self.num_array) - 1):
            if self.num_array[i] == 0 and self.num_array[i + 1] == 1:
                count += 1
                continue
        return count

    def reset(self):
        self.num_array = []


# Example usage
if __name__ == "__main__":
    tracker = EncounterTracker()
    tracker.add_enemy_encounter(False)  # Adds 0
    tracker.add_enemy_encounter(True)  # Adds 1
    tracker.add_enemy_encounter(False)  # Adds 0
    tracker.add_enemy_encounter(True)  # Adds 1
    tracker.add_enemy_encounter(True)  # Adds 1
    tracker.add_enemy_encounter(True)  # Adds 1
    tracker.add_enemy_encounter(False)  # Adds 0
    tracker.add_enemy_encounter(False)  # Adds 0
    tracker.add_enemy_encounter(False)  # Adds 0
    tracker.add_enemy_encounter(True)  # Adds 1
    tracker.add_enemy_encounter(False)  # Adds 0
    print(tracker.num_array)  # Output: [0, 1, 0, 1]
    print(tracker.last_two_same())  # Output: False
    print(tracker.count_01_pairs())  # Output: 2
